<?
class file_browser_templates
{ 
	var $interface=null;
	var $TotalFile=0;
  function layout_header()
  { echo '<html>';
    echo '<head><title>PHP File Browser</title></head>';
	echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
	echo '<link href="'.$this->interface.'/filestyle.css" rel="stylesheet" type="text/css" />';
	echo '<script type="text/javascript" src="'.$this->interface.'/filescript.js" ></script>';
	echo '<script type="text/javascript" src="'.$this->interface.'/checkboxall.js" ></script>';
    echo '<body bgcolor="#686155" style="margin: 0px">';
    echo '<center>';
    echo '<font face="Tahoma" size="2" style="font-size: 10pt">';
    echo '<table align="center" bgcolor="#FFFFFF" border="0" cellpadding="0" cellspacing="0" height="100%" width="780">';
    echo '	<tr>';
    echo '		<td valign="top">';
  }
  function layout_manager($manager="",$create="",$upload="")
  {
    echo '<table align="center" bgcolor="#FFFFFF" border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td bgcolor="#F3F0ED" height="21" nowrap="nowrap"  style="padding-left: 10px">';
	echo '<a href="'.$manager.'"><font face="Tahoma" size="2" style="font-size: 8pt" color="#343434"><b>Quản lý</b></font></a>&nbsp;&nbsp;&nbsp;';
	echo '<a href="'.$create.'"><font face="Tahoma" size="2" style="font-size: 8pt" color="#343434"><b>Tạo thư mục</b></font></a>&nbsp;&nbsp;&nbsp;';
	echo '<a href="'.$upload.'"><font face="Tahoma" size="2" style="font-size: 8pt" color="#343434"><b>Upload</b></font></a>';
	echo '</td></tr></table>';
  }
  function layout_create($url,$err)
  {
  	echo '<form method="post" action="" style="margin:0px">';
	echo '	<table width="100%" border="0" cellspacing="0" cellpadding="0">';
	echo '	  <tr><td style="padding-left:10px" class=style1>'.$err.'</td></tr>';
  	echo '    <tr><td style="padding-left:10px" class=style1>Nhập tên thư mục cần tạo: <input type="text" name="foldername" size="20" class="TextBox"/>';
    echo '	  &nbsp;<input type="submit" name="createfolder" value="Create" class="Button"/>&nbsp;&nbsp;<input type="button" name="cancel" value="Hủy bỏ" onclick="GoUrl(\''.$url.'\');" class="Button"/></td>';
  	echo '</tr></table></form>';
  }
  function layout_upload($url,$directory)
  {
  	echo '<iframe name="iframeupload" src="'.$this->interface.'/file_upload.php" width="100%" height="60" frameborder="0" marginheight="0" marginwidth="0" align="middle" style="display:none;"></iframe>';
	echo '<script type="text/javascript">';
	echo 'function statusUpload(txt){document.getElementById(\'UploadStatus\').innerHTML=txt;}';
	echo 'function finishUpload(url){GoUrl(url);}';
	echo '</script>';
  	echo '<form id="formUpload" method="post" style="margin:0px" enctype="multipart/form-data" action="'.$this->interface.'/file_upload.php?dir='.$directory.'&url='.base64_encode($url).'" target="iframeupload" >';
	echo '<table width="80%" border="0" cellspacing="0" cellpadding="3" align=center>';
	echo '<tr><td colspan="2" align=center><div id="UploadStatus" class=style1>&nbsp;</div></td></tr>';
	echo '<tr><td class="style1">File: <input type="file" name="FileLink[]" size="30" class="TextBox"/></td>';
	echo '<td class="style1">File: <input type="file" name="FileLink[]" size="30" class="TextBox"/></td>';
	echo '</tr><tr>';
	echo '<td class="style1">File: <input type="file" name="FileLink[]" size="30" class="TextBox"/></td>';
	echo '<td class="style1">File: <input type="file" name="FileLink[]" size="30" class="TextBox"/></td>';
	echo '</tr><tr><td colspan="2" align=center><input type="submit" name="UploadFile" class="Button" value="Đồng ý" onclick="statusUpload(\'Đang tải dữ liệu ...\')"/>&nbsp;&nbsp;<input type="reset" name="reset" value="Làm lại" class=button>&nbsp;&nbsp;<input type="button" name="cancel" value="Hủy bỏ" onclick="GoUrl(\''.$_SERVER['PHP_SELF'].'?dir='.$directory.'\');" class="Button"/></td></tr></table>';
	echo '</form></span>';
  }
  
  function layout_renamefolder($folder,$err="",$url)
  {
  	echo '<form method="post" action="" style="margin:0px">';
	echo '	<table width="100%" border="0" cellspacing="0" cellpadding="0">';
	echo '	  <tr><td style="padding-left:10px" class=style1>'.$err.'</td></tr>';
  	echo '    <tr><td style="padding-left:10px" class=style1>Đổi tên thư mục <font style="color:#FF0000">'.$folder.'</font> thành tên : <input type="text" name="foldername" size="20" class="TextBox"/>';
    echo '	  <input type="submit" name="renamefolder" value="Đồng ý" class="Button"/>&nbsp;&nbsp;';
	echo '	  <input type="button" name="cancel" value="Hủy bỏ" onclick="GoUrl(\''.$url.'\');" class="Button"/>';
  	echo '	  </td></tr></table>';
	echo '</form>';
  }
  
  function layout_delfolder($folder,$err="")
  {
	echo '	<table width="100%" border="0" cellspacing="0" cellpadding="0">';
	echo '	  <tr><td style="padding-left:10px" class=style1>'.$err.'</td></tr>';
  	echo '	</table>';
  }
  
  function layout_leftstart()
  {
  	echo '<table width="100%" border="1" height=100% style="border-collapse:collapse" cellspacing="0" cellpadding="5"><tr><td width=30% valign=top>';
	echo '<table align="center" bgcolor="#FFFFFF" border="0" cellpadding="0" cellspacing="0" width="100%">';
  }
  function layout_leftend()
  {
    echo '</table></td>';
  }
  function layout_rightstart()
  {
  	echo '<td>';
	echo '<table align="center" bgcolor="#FFFFFF" border="0" cellpadding="0" cellspacing="0" height="100%" width="100%">';
    echo '	<tr>';
    echo '		<td valign="top">';
  }
  function layout_rightend()
  {
  	if($this->TotalFile!=0) echo '<tr><td colspan=6><input type="submit" name="submit" value="   Xóa   " class="Button" onClick="">&nbsp;&nbsp;<input type="reset" value="Làm lại" class="Button"></td></tr>';
  	//if($this->TotalFile!=0) echo '<tr><td colspan=6><input type="reset" value="Làm lại" class="Button"></td></tr>';
  	echo '</table></form></td>';
    echo '	</tr></table></td></tr></table>';
  }
  function layout_current_folder($current_folder)
  {
  	echo '<tr bgcolor="#2E2E2E" height=21><td align=left nowrap="nowrap" style="padding-left: 10px">';
	echo '<font face="Tahoma" size=1 style="font-size: 8pt" color="#808080"><b>'.$current_folder.'</b>';
    echo '</td></tr>';
	echo '<tr>';
    echo '<td align=center colspan="7"><img src="'.$this->interface.'/pixel.gif" width=4 height=4></td>';
    echo '</tr>';
	echo '<tr><td align=center><div id="ViewFile"></div></td></tr>';
  }
  function layout_footer($directory,$select,$version)
  { 
    echo '		</td>';
    echo '	</tr>';
    echo '</table>';
    echo '</font>';
    echo '</center>';
    echo '</body>';
    echo '</html>';
  }
  function layout_nofiles($filter)
  { echo '	<tr>';
    echo '		<td align="center" bgcolor="#F3F0ED" width="10"  height="21" nowrap="nowrap" style="">&nbsp;</td>';
    echo '		<td align="center" bgcolor="#F3F0ED" colspan="4" nowrap="nowrap" style="padding-left: 05px; padding-right: 05px"><font face="Tahoma" size="2" style="font-size: 8pt" color="#343434"><b>No files'; if ($filter) echo ' match the filter you have selected.'; else echo '.'; echo '</b></font></td>';
    echo '		<td align="center" bgcolor="#F3F0ED" width="10"  height="21" nowrap="nowrap" style="">&nbsp;</td>';
    echo '	</tr>';
    echo '	<tr>';
    echo '		<td align="center" bgcolor="#FFFFFF" colspan="7"><img alt="" border="0" src="'.$this->interface.'/separator-orizontal.gif"/></td>';
    echo '	</tr>';
    echo '	<tr>';
    echo '		<td align="center" bgcolor="#FFFFFF" colspan="7"><img alt="" border="0" src="'.$this->interface.'/pixel.gif" height="4" width="4"></td>';
    echo '	</tr>';
  }

  function layout_headings($url)
  { 
  	echo '<form name="frmListFile" method="post" action="'.$url.'" onSubmit="return checkInput(this,\'Bạn hãy chọn ít nhất một giá trị\',\'Bạn chắc chắn muốn xoá không\');" style="margin:0px">
<input type="hidden" name="chon" />';
    echo '			<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">';
    echo '				<tr>';
    echo '					<td align="center" bgcolor="#2E2E2E" width="20" height="21" nowrap="nowrap" style="">';
	if($this->TotalFile!=0) echo '<input type="checkbox" name="chkall" value="0" onClick="docheck(this.form,0);">';
	else echo '&nbsp;';
	echo '</td>';
    echo '					<td align="center" bgcolor="#2E2E2E"  width="40" height="21" nowrap="nowrap" style="padding-left: 05px; padding-right: 5px"><font face="Tahoma" size=1 style="font-size: 8pt; text-decoration: none;" color="#808080"><b>Kiểu</b></font></td>';
    echo '					<td align="left" bgcolor="#2E2E2E"   width="50" height="21" nowrap="nowrap" style="padding-left: 05px; padding-right: 10px"><font face="Tahoma" size=1 style="font-size: 8pt; text-decoration: none;" color="#808080"><b>Tên file</b></font></td>';
    echo '					<td align="right" bgcolor="#2E2E2E"  height="21" nowrap="nowrap" style="padding-left: 05px; padding-right: 10px"><font face="Tahoma" size=1 style="font-size: 8pt; text-decoration: none;" color="#808080"><b>Kích thước</b></font></td>';
    echo '					<td align="right" bgcolor="#2E2E2E" height="21" nowrap="nowrap" style="padding-left: 05px; padding-right: 05px" width=150><font face="Tahoma" size=1 style="font-size: 8pt; text-decoration: none;" color="#808080"><b>Thời gian tạo file</b></font></td>';
    echo '					<td align="center" bgcolor="#2E2E2E" width="10"  height="21" nowrap="nowrap" style="">&nbsp;</td>';
    echo '				</tr>';
    echo '				<tr>';
    echo '					<td align=center colspan="7"><img src="'.$this->interface.'/pixel.gif" width=4 height=4></td>';
    echo '				</tr>';
  }

  function layout_letters($chrooted,$directory,$select)
  { foreach(array_map('chr',range(ord('a'),ord('z'))) as $letter) $letters[]=$letter;
    echo '			<table align="center" border=0 cellspacing=0 cellpadding=0 height=21>';
    echo '				<tr>';
    echo '					<td align=center bgcolor="#'; if ($select=="numbers") echo "BF000D"; else echo "2E2E2E"; echo '" onmouseover="this.style.cursor = \'hand\'" onmouseup="location.href=\''.$_SERVER['PHP_SELF']; if ($chrooted!=$directory) echo '?dir='.realpath($directory).'&'; else echo '?'; echo 'select=numbers\'" width=22><a href="'.$_SERVER['PHP_SELF']; if ($chrooted!=$directory) echo '?dir='.realpath($directory).'&'; else echo '?'; echo 'select=numbers" style="text-decoration: none"><font face="Tahoma" style="font-size: 8pt" size=1 color=white><b>#</b></a></td><td align="center" bgcolor="#FFFFFF" width="2"></td>';
    for ($X=0; $X<count($letters); $X++) { echo '					<td align="center" bgcolor="#'; if ($select==$letters[$X]) echo 'BF000D'; else echo '2E2E2E'; echo '" onmouseover="this.style.cursor = \'hand\'" onmouseup="location.href=\''.$_SERVER['PHP_SELF']; if ($chrooted!=$directory) echo '?dir='.realpath($directory).'&'; else echo '?'; echo 'select='.$letters[$X].'\'" width="22"><a href="'.$_SERVER['PHP_SELF']; if ($chrooted!=$directory) echo '?dir='.realpath($directory).'&'; else echo '?'; echo 'select='.$letters[$X].'" style="text-decoration: none"><font face="Tahoma" style="font-size: 8pt" size=1 color=white><b>'.ucfirst($letters[$X]).'</b></a></td><td align="center" bgcolor="#FFFFFF" width="2"></td>'; }
    echo '					<td align=center bgcolor="#'; if ($select=="all" OR $select=="") echo 'BF000D'; else echo '2E2E2E'; echo '" onmouseover="this.style.cursor = \'hand\'" onmouseup="location.href=\''.$_SERVER['PHP_SELF']; if ($chrooted!=$directory) echo '?dir='.realpath($directory); echo '" width="132"><a href="'.$_SERVER['PHP_SELF']; if ($chrooted!=$directory) echo '?dir='.realpath($directory); echo '" style="text-decoration: none"><font face="Tahoma" style="font-size: 8pt" size=1 color=white><b>All</b></a></td>';
    echo '				</tr>';
    echo '			</table>';
    echo '			<img src="'.$this->interface.'/pixel.gif" width=4 height=4><br>';
  }

  function layout_folder($filename)
  { echo '	<tr>';
  	echo '		<td align="left" bgcolor="#F3F0ED" style="text-decoration: none;vertical-align:top" height="21" nowrap="nowrap">';
	if($filename['title']!="[..]")
	{
	echo '<a href="'.$filename['delete'].'" onclick="return CheckConfirm(\'Bạn chắc chắn muốn xóa không?\')"><img src="'.$this->interface.'/images/del.gif" border=0 alt="Xóa: '.$filename['title'].'"></a>';
	echo '<a href="'.$filename['rename'].'"><img src="'.$this->interface.'/images/renamefolder.gif" border=0 alt="Đổi tên: '.$filename['title'].'"></a>';
	}
	else
	{
		echo '<img src="'.$this->interface.'/images/trans.gif" border=0">';
		echo '<a href="'.$filename['link'].'"><img src="'.$this->interface.'/images/up.gif" border=0 alt="Trở ra"></a>';
	}
    echo '		<a href="'.$filename['link'].'" style="text-decoration: none;vertical-align:middle"><font face="Tahoma" size="2" style="font-size: 8pt" color="#343434"><b>'.$filename['title'].'</b></font></a></td>';
    echo '	</tr>';
    echo '	<tr>';
    echo '		<td align="center" bgcolor="#FFFFFF"><img alt="" border="0" src="'.$this->interface.'/separator-orizontal.gif"/></td>';
    echo '	</tr>';
    echo '	<tr>';
    echo '		<td align="center" bgcolor="#FFFFFF"><img alt="" border="0" src="'.$this->interface.'/pixel.gif" height="4" width="4"></td>';
    echo '	</tr>';

  }
  
  function layout_row($filename)
  { echo '	<tr>';
    echo '		<td align="center" bgcolor="#F3F0ED" width="20"  height="21" nowrap="nowrap" style=""><input type="checkbox" name="Xoa" value="'.$filename['title'].'" onClick="docheckone(this.form);"></td>';
    echo '		<td align="center" bgcolor="#F3F0ED"  height="21" nowrap="nowrap" style="padding-left: 05px; padding-right: 5px"><a href="javascript:" onclick="javascript:ViewFile(\'ViewFile\',\''.$this->interface.'/file_view.php\',\''.base64_encode($filename['webpath']).'\',\''.base64_encode($filename['title']).'\');"><img src="'.$this->interface.'/images/'.$filename['type'].'" alt="Nhấn vào đây để xem" border=0></a></td>';
    echo '		<td align="left" bgcolor="#F3F0ED"   height="21" nowrap="nowrap" style="padding-left: 05px; padding-right: 05px"><a href="javascript:" onclick="'.$filename['link'].'" style="text-decoration: none" title="Nhấn vào đây để chọn"><font face="Tahoma" size="2" style="font-size: 8pt" color="#343434"><b>'.$filename['title'].'</b></font></a></td>';
    echo '		<td align="right" bgcolor="#F3F0ED"  height="21" nowrap="nowrap" style="padding-left: 05px; padding-right: 10px"><font face="Tahoma" size="2" style="font-size: 8pt" color="#AEAAA6"><b>'.$filename['size'].'</b></font></td>';
    echo '		<td align="right" bgcolor="#F3F0ED"  height="21" nowrap="nowrap" style="padding-left: 05px; padding-right: 05px"><font face="Tahoma" size="1" style="font-size: 8pt" color="#AEAAA6"><b>'.$filename['update'].'</b></font></td>';
    echo '		<td align="center" bgcolor="#F3F0ED" width="10"  height="21" nowrap="nowrap" style="">&nbsp;</td>';
    echo '	</tr>';
    echo '	<tr>';
    echo '		<td align="center" bgcolor="#FFFFFF" colspan="7"><img alt="" border="0" src="'.$this->interface.'/separator-orizontal.gif"/></td>';
    echo '	</tr>';
    echo '	<tr>';
    echo '		<td align="center" bgcolor="#FFFFFF" colspan="7"><img alt="" border="0" src="'.$this->interface.'/pixel.gif" height="4" width="4"></td>';
    echo '	</tr>';
  }
}

?>